const http = uni.$u.http;


// 获取注册短信验证码
export const sendRegisterSMS = (params, config = {}) => http.post('/openapi/sendRegisterMessage', params, config);
// 获取登录短信验证码
export const sendLoginSMS = (params, config = {}) => http.post('/openapi/sendLoginMessage', params, config);
// 获取绑定新手机短信验证码
export const sendBindPhoneSMS = (params, config = {}) => http.post('/openapi/sendBindPhoneMessage', params, config);
// 获取解绑手机短信验证码
export const sendUnbindPhoneSMS = (params, config = {}) => http.post('/openapi/sendRelieveBindPhoneMessage', params,
    config);
// 获取修改密码短信验证码
export const sendPasswordSMS = (params, config = {}) => http.post('/openapi/sendUpdatePasswordMessage', params, config);

// 用户注册
export const register = (params, config = {}) => http.post('/openapi/register', params, config);


// 用户登录
export const login = (params, config = {}) => http.post('/openapi/login', params, config);
// 微信公众号一键登录
export const wxLogin = (params, config = {}) => http.post('/openapi/weiXinLogin', params, config);
// 微信小程序一键登录
export const wxMpLogin = (params, config = {}) => http.post('/openapi/smallProgramLogin', params, config);
// 退出登录
export const clearMember = (data = {
    custom: {
        load: false
    }
}) => http.get('/approve/members/clearMember', data);


// 绑定手机
export const bindPhone = (params, config = {}) => http.post('/approve/members/bindPhoneOrMerge', params, config);
// 修改绑定手机
export const updateBindPhone = (params, config = {}) => http.post('/approve/members/updateBandTelPhone', params,
    config);
// 修改密码
export const updatePassword = (params, config = {}) => http.post('/approve/members/updateMemberPwd', params, config);


// 获取会员信息
export const getMemberInfo = (data) => http.get('/approve/members/getMemberInfo', data);
// 上传图片
export const uploadIMG = (params, config = {}) => http.post('/approve/members/memberUploadImage', params, config);
// 修改用户资料
export const updateMember = (params, config = {}) => http.post('/approve/members/updateMember', params, config);
// 获取我的资产
export const getMyAsset = (data) => http.get('/approve/members/getMyAsset', data);


// 获取行政区域
export const getRegion = (data) => http.get('/openapi/common/regionSelect', data);
// 获取收货地址列表
export const getAddressList = (data) => http.get('/approve/members/getMemberShippingAddressList', data);
// 获取收货地址详情
export const getAddressDetail = (data) => http.get('/approve/members/getMemberShippingAddressDetail', data);
// 新增或修改收货地址
export const postAddress = (params, config = {}) => http.post('/approve/members/submitMemberShippingAddress', params,
    config);
// 删除收货地址
export const delAddress = (params, config = {}) => http.post('/approve/members/removeMemberShippingAddress', params,
    config);
// 设为默认收货地址
export const setDefaultAddress = (params, config = {}) => http.post('/approve/members/defaultMemberShippingAddress',
    params, config);
// 得到默认收货地址
export const getDefaultAddress = (params, config = {}) => http.post('/approve/members/getDefaultMemberShippingAddress',
    params, config);


// 获取发票列表
export const getInvoiceList = (data) => http.get('/approve/members/getMemberInvoiceList', data);
// 获取发票详情
export const getInvoiceDetail = (data) => http.get('/approve/members/getInvoiceDetail', data);
// 新增或修改发票
export const postInvoice = (params, config = {}) => http.post('/approve/members/submitMemberInvoice', params, config);
// 删除发票
export const delInvoice = (params, config = {}) => http.post('/approve/members/removeMemberInvoice', params, config);
// 设为默认发票
export const setDefaultInvoice = (params, config = {}) => http.post('/approve/members/defaultMemberInvoice', params,
    config);
// 得到默认发票
export const getDefaultInvoice = (params, config = {}) => http.post('/approve/members/getDefaultMemberInvoice', params,
    config);


// 获取品牌列表
export const getBrandList = (data) => http.get('/openapi/common/getBrandList', data);


// 获取分类列表（所有）
export const getCategoryList = (data) => http.get('/openapi/common/getCategoryList', data);
// 获取分类子类
export const getCategoryTreeList = (data) => http.get('/openapi/common/getCategoryTreeList', data);


// 获取商品列表
export const getProductList = (data) => http.get('/openapi/common/getProductList', data);
// 获取商品详情
export const getProductDetail = (data) => http.get('/openapi/common/getProductDetail', data);


// 得到购物车列表
export const getShoppingCartList = (data) => http.get('/approve/product/getShoppingCartList', data);
// 添加修改购物车
export const postShoppingCart = (params, config = {}) => http.post('/approve/product/saveShoppingCart', params, config);
// 得到购物车数量
export const getShoppingCartCount = (data) => http.get('/approve/product/getShoppingCartCount', data);
// 删除购物车商品
export const delShoppingCart = (params, config = {}) => http.post('/approve/product/removeShoppingCart', params,
    config);


// 得到收藏列表
export const getConllectionList = (data) => http.get('/approve/product/getConllectionList', data);
// 是否收藏商品（传skuID）
export const getIsCollection = (params, config = {}) => http.post('/approve/product/getIsCollection', params, config);
// 添加收藏
export const addCollection = (params, config = {}) => http.post('/approve/product/saveCollection', params, config);
// 删除收藏
export const removeCollection = (params, config = {}) => http.post('/approve/product/removeCollection', params, config);


// 得到运费和限制区域
export const getFregihtAndArea = (params, config = {}) => http.post('/approve/product/getFregihtAndArea', params,
    config);


// 提交订单
export const postSubmitOrder = (params, config = {}) => http.post('/approve/members/submitOrder', params, config);
// 生成支付订单
export const saveOrderPay = (params, config = {}) => http.post('/approve/members/saveOrderPay', params, config);
// 取消订单
export const orderCancel = (params, config = {}) => http.post('/approve/members/orderCancel', params, config);
// 确认收货
export const orderConfirm = (params, config = {}) => http.post('/approve/members/orderConfirm', params, config);
// 新增或修改发票
export const saveOrderInvoice = (params, config = {}) => http.post('/approve/members/saveOrderOrderInvoice', params,
    config);
// 新增订单商品评论
export const saveOrderComment = (params, config = {}) => http.post('/approve/members/saveOrderComment', params, config);
// 得到订单评论
export const getOrderComment = (params, config = {}) => http.post('/approve/members/getOrderCommentList', params,
    config);


// 获取订单列表
export const getOrderList = (data) => http.get('/approve/members/getOrderList', data);
// 获取订单详情
export const getOrderDetail = (data) => http.get('/approve/members/getOrderDetail', data);
// 得到订单各种状态数量
export const getOrderStatusCount = (params, config = {}) => http.post('/approve/members/getOrderStatusCount', params,
    config);
// 得到服务器当前时间
export const getCurrentDate = (params, config = {}) => http.post('/openapi/common/getCurrentDate', params, config);


// 实时查询快递
export const selectExpress = (params, config = {}) => http.post('/approve/members/selectExpress', params, config);

// 申请售后操作
export const orderAfterSales = (params, config = {}) => http.post('/approve/members/orderAfterSales', params, config);
// 取消售后操作
export const orderAfterSalesCancel = (params, config = {}) => http.post('/approve/members/orderAfterSalesCancel',
    params, config);
// 得到售后订单列表
export const getOrderAfterSalesList = (data) => http.get('/approve/members/getOrderAfterSalesList', data);
// 得到售后订单详情
export const getOrderAfterSalesDetail = (data) => http.get('/approve/members/getOrderAfterSalesDetail', data);
// 得到售后订单详情日志
export const getAtferSalesLog = (data) => http.get('/approve/members/getAtferSalesLog', data);
// 得到售后数量详情
export const getAfterSalesNum = (data) => http.get('/approve/members/getAfterSalesNum', data);
// 填写退货物流信息
export const saveOrderLogistic = (params, config = {}) => http.post('/approve/members/saveOrderLogistic', params,
    config);
// 得到所有快递公司
export const getAllExpress = (data) => http.get('/approve/members/getAllExpress', data);


// 得到可领取优惠券列表
export const getCouponList = (data) => http.get('/openapi/common/getCouponList', data);
// 领取优惠券
export const receiveCoupon = (params, config = {}) => http.post('/approve/members/receiveCoupon', params, config);
// 得到我的优惠券列表
export const getMemberCoupon = (data) => http.get('/approve/members/getMemberCoupon', data);
// 根据商品SKU获取优惠券
export const getProductSkuCoupon = (params, config = {}) => http.post('/openapi/common/getProductSkuCoupon', params,
    config);
// 提交订单时获取可用优惠券
export const getProductCoupon = (params, config = {}) => http.post('/approve/members/getProductCoupon', params, config);


// 文章树状分类
export const getAtricleCategoryTree = (data) => http.get('/openapi/common/getAtricleCategoryTree', data);
// 文章根据父级获取子类
export const getAtricleCategoryList = (data) => http.get('/openapi/common/getList', data);
// 文章列表
export const getNoticeList = (data) => http.get('/openapi/common/getNoticeList', data);
// 文章详情
export const getNoticeDetails = (data) => http.get('/openapi/common/getNoticeDetails', data);

// 获取客服列表
export const getCustomerList = () => http.get('/approve/customer/getCustomerList');
// 获取聊天消息
export const getChatList = (data) => http.get('/approve/customer/getChatList', data);
// 发送聊天消息
export const sendMessage = (params, config = {}) => http.post('/openapi/sendMessage/socket/push', params, config);
// 获取咨询联系人列表
export const getContacts = (data) => http.get('/approve/customer/getContacts', data);

// 获取公众号jssdk配置
export const getJsapiSignature = (data) => http.get('/openapi/wxMpService/getJsapiSignature', data);


// 钱包充值提交
export const getWalletSubmit = (params, config = {}) => http.post('/approve/members/walletSubmit', params, config);
// 钱包明细
export const getMemberAccount = (data) => http.get('/approve/members/account/list', data);
// 设置支付密码
export const settingPayPwd = (params, config = {}) => http.post('/approve/members/settingPayPwd', params, config);
// 修改支付密码，验证旧密码
export const verifyOldPayPwd = (params, config = {}) => http.post('/approve/members/verifyOldPayPwd', params, config);
// 钱包支付（用余额付款）
export const walletPay = (params, config = {}) => http.post('/approve/members/walletPay', params, config);

// 得到可提现银行
export const getAllWithdrawBank = (data) => http.get('/approve/withdraw/getAllWithdrawBank', data);
// 默认提现方式
export const getDefaultWithdrawAccount = (data) => http.get('/approve/withdraw/getDefaultWithdrawAccount', data);
// 所有提现方式
export const getAllWithdrawAccount = (data) => http.get('/approve/withdraw/getAllWithdrawAccount', data);
// 新增修改提现方式
export const submitWithdrawAccount = (params, config = {}) => http.post('/approve/withdraw/submitWithdrawAccount', params, config);
// 申请提现
export const sumbitWithdrawApply = (params, config = {}) => http.post('/approve/withdraw/sumbitWithdrawApply', params, config);


//分销
//查询当前商品是否是分销商品
export const getDistributionProductById = (data) => http.get('/openapi/common/getDistributionProductById', data);
//获取默认的分销比例
export const getDistributionDefaultRatio = () => http.get('/openapi/common/getDistributionDefaultRatio');

//判断当前用户是否绑定了上级
export const getBindingParent = () => http.get('/approve/distribution/getBindingParent');
// 获取我的分销订单列表
export const getDistributionOrderList = (data) => http.get('/approve/distribution/getOrderList', data);

//统计当前分销员的信息
export const getDistributionStatistics = () => http.get('/approve/distribution/getStatistics');

//获取和我绑定的用户
export const getMyAffiliate = () => http.get('/approve/distribution/getMyAffiliate');

// 获取分销商品列表
export const getDistributionProductList = (data) => http.get('/openapi/common/getDistributionProductList', data);


//返利记录分页
export const getRebateListList = (data) => http.get('/approve/members/account/rebateList', data);

export const getRebateStatistics = (data) => http.get('/approve/members/account/rebateStatistics', data);


//得到优惠券详情
export const getMemberCouponInfo_Api = (data) => http.get('/approve/members/getMemberCouponInfo', data);


export const forwardCoupon_Api = (data,config={}) => http.post('/approve/members/forward', data,config);


